package com.sgb.kjwl.view.ui.activity.self.team;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;

import androidx.core.util.Pair;
import androidx.databinding.DataBindingUtil;

import com.sgb.kjwl.AppActivity;
import com.sgb.kjwl.R;
import com.sgb.kjwl.databinding.ActivityTeamFuncationBinding;
import com.sgb.kjwl.di.self.DaggerSelfComponent;
import com.sgb.kjwl.di.self.SelfModule;
import com.sgb.kjwl.utils.ActivityJump;
import com.sgb.kjwl.view.ui.activity.enterprise.ProfessionalTeamPictureActivity;
import com.sgb.kjwl.view.ui.activity.enterprise.ServiceQuoteListActivity;
import com.sgb.kjwl.view.ui.activity.enterprise.TalentListActivity;
import com.sgb.kjwl.view.ui.activity.enterprise.TeamIntelligenceListActivity;
import com.sgb.kjwl.view.ui.activity.enterprise.UserCenterTeamDetailActivity;
import com.sgb.kjwl.viewmodel.self.team.TeamFunctionModel;
import com.swgk.core.base.di.AppComponent;
import com.swgk.core.customview.ItemInputTextView;

import javax.inject.Inject;


/**
 * 团队功能界面
 */
public class TeamFunctionActivity extends AppActivity implements ItemInputTextView.OnWholeItemClickListener, View.OnClickListener {

    @Inject
    TeamFunctionModel viewModel;
    ActivityTeamFuncationBinding binding;
    String id;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    //设置状态栏为暗
    @Override
    protected boolean statusBarDark() {
        return true;
    }

    @Override
    protected void setupActivityComponent(AppComponent appComponent) {
        DaggerSelfComponent.builder().appComponent(appComponent).selfModule(new SelfModule(this)).build().inject(this);
    }

    //跳转
    public static void start(Context context, String id) {
        Intent intent = new Intent();
        intent.putExtra("id", id);
        intent.setClass(context, TeamFunctionActivity.class);
        context.startActivity(intent);
    }


    @Override
    protected void initView() {
        //双向绑定Activity和View
        binding = DataBindingUtil.setContentView(TeamFunctionActivity.this, R.layout.activity_team_funcation);
        id = getIntent().getStringExtra("id");
        binding.include.titleView.setText("团队信息");
        binding.include.ivBack.setOnClickListener(this);
        binding.itemTvBaseInfo.setOnWholeItemClickListener(this);
        binding.itemTvTeamQualification.setOnWholeItemClickListener(this);
        binding.itemTvServiceCase.setOnWholeItemClickListener(this);
        binding.itemTvTheExcellentTalents.setOnWholeItemClickListener(this);
        binding.itemTvTeamAlbum.setOnWholeItemClickListener(this);
    }

    @Override
    protected void init() {
    }

    @Override
    public void OnWholeItemClick(View view) {
        switch (view.getId()) {
            case R.id.item_tv_base_info:
                //基本信息
                ActivityJump.jumpToActivity(this, UserCenterTeamDetailActivity.class);
                break;
            case R.id.item_tv_team_qualification:
                //团队资质
                ActivityJump.jumpToActivity(this, TeamIntelligenceListActivity.class, Pair.create("teamNo", id), Pair.create("isUserCenter", true));
                break;
            case R.id.item_tv_service_case:
                //服务案例
                ActivityJump.jumpToActivity(this, ServiceQuoteListActivity.class, Pair.create("isUserCenter", true));
                break;
            case R.id.item_tv_the_excellent_talents:
                //优秀人才
                ActivityJump.jumpToActivity(this, TalentListActivity.class, Pair.create("isUserCenter", true));
                break;
            case R.id.item_tv_team_album:
                //团队相册
                ActivityJump.jumpToActivity(this, ProfessionalTeamPictureActivity.class, Pair.create("isUserCenter", true));
                break;
        }
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.iv_back:
                finish();
                break;
        }
    }
}
